<?php
 header('Content-Type:text/html;charset=utf-8');
  // 连接数据库
  $dbservername = 'localhost';
  $dbusername = 'root';
  $dbpassword = 'root';
  $dbname = 'libray';
  $conn = mysqli_connect($dbservername, $dbusername, $dbpassword, $dbname);
  if(!$conn) {
    die('连接失败'.mysqli_connect_error());
  }

  // 定义弹窗
  function alert($str, $url) {
    echo "<script> alert(' $str '); location.href=' $url '; </script>";
  }

  session_start();
?>